import { Model } from "./model";

export class Rendering{

    constructor(component){
        this.renderHTML(component);
        this.onEvents();
    }

    renderHTML(component){
        document.querySelector(".content").innerHTML = `
            <div class="index-menu">
                <ul class="index-nav">
                    <li><a><span class="fa fa-question-circle-o"></span>提问</a><span class="segmentation">|</span></li>
                    <li><a><span class="fa fa-file-text-o"></span>回答</a><span class="segmentation">|</span></li>
                    <li><a href="#/essay"><span class="fa fa-edit"></span>写文章</a></li>
                </ul><br>
                <p class="new-dynamic">最新动态</p>
                <div class="content-meun">
                    ${component}
                </div>
                
            </div>
            
        `
    }

    onEvents(){
        let dom = document.querySelectorAll(".show-all");
        let comment = document.querySelectorAll(".content-comment-length");
        Model.onContent(dom);
        Model.onShowComment(comment);
    }
}
